package cn.lzd.mr.case2;

/**
 * Created by lzd on 2018/5/31.
 *
 * 实现 WritableComparable<Bean>
 * 既可以序列化，又可以比较。
 * map和reduce都可以把bean作为key,值为null。mr会自动排序
 */
public class Bean implements Comparable<Bean> {
    private String site;
    private int count;

    public Bean(String site, int count) {
        this.site = site;
        this.count = count;
    }

    public void setSite(String site) {
        this.site = site;
    }

    public void setCount(int count) {
        this.count = count;
    }

    public String getSite() {
        return site;
    }

    public int getCount() {
        return count;
    }

    @Override
    public int compareTo(Bean o) {
        return Integer.compare(o.getCount(),this.getCount());
    }
}
